home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
cpphtp2
/
code.jar
/
code
/
ch15
/
fig15_11.txt
< prev
next >
Wrap
Text File
|
1998-02-27
|
596b
|
20 lines
1 // Fig. 15.11: stack_c.h
2 // Definition of Stack class composed of List object
3 #ifndef STACK_C
4 #define STACK_C
5 #include "list.h"
6
7 template< class STACKTYPE >
8 class Stack {
9 public:
10 // no constructor; List constructor does initialization
11 void push( const STACKTYPE &d ) { s.insertAtFront( d ); }
12 bool pop( STACKTYPE &d ) { return s.removeFromFront( d ); }
13 bool isStackEmpty() const { return s.isEmpty(); }
14 void printStack() const { s.print(); }
15 private:
16 List< STACKTYPE > s;
17 };
18
19 #endif